﻿using Ecommerce.API.Application.Command.RoleCommand;
using Ecommerce.Domain;
using Ecommerce.Services.User;
using MediatR;

namespace Ecommerce.API.Application.CommandHandlers.RoleHandler
{
    public class RoleGetCommandHandler : IRequestHandler<RoleGetCommand, List<Role>>
    {
        private readonly IUseInfoServices services;

        public RoleGetCommandHandler(IUseInfoServices services)
        {
            this.services = services;
        }

        public async Task<List<Role>> Handle(RoleGetCommand request, CancellationToken cancellationToken)
        {
            return await services.GetRoles();
        }
    }
}
